﻿@section PageTitle { Installation }

<p>The easiest way to get started is using <a href="http://nuget.org">NuGet</a>. The basic packages are:</p>
<ul>
	<li><a href="http://nuget.org/packages/DynamicImage/">DynamicImage</a></li>
	<li><a href="http://nuget.org/packages/DynamicImage.Mvc/">DynamicImage.Mvc</a> (ASP.NET MVC 3)</li>
	<li><a href="http://nuget.org/packages/DynamicImage.Mvc4/">DynamicImage.Mvc4</a> (ASP.NET MVC 4)</li>
</ul>

<p>Each @Html.ActionLink("extension", "Index", "Extensions") has its own NuGet package:</p>
<ul>
	<li><a href="http://nuget.org/packages/DynamicImage.Extensions.ContentAwareResizing/">DynamicImage.Extensions.ContentAwareResizing</a></li>
	<li><a href="http://nuget.org/packages/DynamicImage.Extensions.Pdf/">DynamicImage.Extensions.Pdf</a> - this package is ~20Mb, because it includes the unmanaged
		Ghostscript DLLs necessary for saving PDF pages as images
	</li>
	<li><a href="http://nuget.org/packages/DynamicImage.Extensions.Rendered3D/">DynamicImage.Extensions.Rendered3D</a> - depends on several other packages, including SharpDX</li>
	<li><a href="http://nuget.org/packages/DynamicImage.Extensions.WebsiteScreenshot/">DynamicImage.Extensions.WebsiteScreenshot</a> - this package is ~20Mb, because it includes the unmanaged <code>CutyCapt.exe</code></li>
</ul>

<h2>DynamicImage</h2>

<p>The <a href="http://nuget.org/packages/DynamicImage/">DynamicImage</a> package provides the primary DLL, 
<code>SoundInTheory.DynamicImage.dll</code>, and adds a <code>DynamicImage.cs</code> file to your 
<code>App_Start</code> folder, with the following code:</p>
	
<pre class="prettyprint">
using Microsoft.Web.Infrastructure.DynamicModuleHelper;

[assembly: WebActivatorEx.PreApplicationStartMethod(typeof($namespace$.DynamicImage), "PreStart")]

namespace $namespace$.App_Start
{
	public static class DynamicImage
	{
		public static void PreStart()
		{
			DynamicModuleUtility.RegisterModule(typeof(SoundInTheory.DynamicImage.DynamicImageModule));
		}
	}
}
</pre>

<p>For DynamicImage to work correctly, all requests - not just page requests - must be processed by ASP.NET.
For IIS Integrated Mode, make sure you have this line in your <code>web.config</code>:</p>

<pre class="prettyprint">
&lt;system.webServer&gt;
  &lt;modules runAllManagedModulesForAllRequests="true" /&gt;
&lt;/system.webServer&gt;
</pre>

<h2>DynamicImage.Mvc</h2>

<p>The <a href="http://nuget.org/packages/DynamicImage.Mvc/">DynamicImage.Mvc</a> package adds an HtmlHelper extension method, <code>DynamicImageTag</code>. 
	This makes it easier to create images inline in your ASP.NET MVC views.</p>

<pre class="prettyprint">
@@Html.DynamicImageTag(b => b.WithLayer(LayerBuilder.Image.SourceFile("~/Assets/Images/Desert.jpg")
	.WithFilter(new ContentAwareResizeFilterBuilder().To(940, 300))))
</pre>

<hr />

<p>The <a href="https://github.com/tgjones/dynamic-image">source code</a> is on GitHub, so you can also download the source and build your own binaries.</p>
